from Examples.DQNExamples.SlayTheSpire.SlayTheSpireBase import Card


class CardAttack(Card):
    def __init__(self):
        super().__init__(id=1, name="Attack", description="Deal 6 damage", cost=1, type="attack")
        self.damage = 6
        self.damage_num = 1

    def use(self, monster, player, game):
        if player.mp < self.cost:
            return False
        player.mp -= self.cost
        for _ in range(self.damage_num):
            self.attack(self.damage, monster, player)


class CardDefend(Card):
    def __init__(self):
        super().__init__(id=2, name="Defend", description="Gain 5 block", cost=1, type="skill")
        self.block = 5
        self.defend_num = 1

    def use(self, monster, player, game):
        if player.mp < self.cost:
            return False
        player.mp -= self.cost
        for _ in range(self.defend_num):
            self.defend(player.defend, player)


class CardCrack(Card):
    def __init__(self):
        super().__init__(id=3, name="Crack", description="造成8点伤害,给予2层易伤", cost=2, type="attack")
        self.damage = 8
        self.damage_num = 1

    def use(self, monster, player, game):
        if player.mp < self.cost:
            return False
        player.mp -= self.cost
        for _ in range(self.damage_num):
            self.attack(self.damage, monster, player)
        monster.buffer[4] += 2


all_cards = {
    1: CardAttack(),
    2: CardDefend(),
    3: CardCrack(),
}
